<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%>
<%@ page import="java.util.ArrayList" %>
<%@ page import="entidades.*" %>

<%
//si esta logeado
if(session.getAttribute("currentSessionUser") != null){
	session.setAttribute("paginaActiva", "ABMMaterias");
%>

<%@ include file = "estructura/Header.jsp" %>

<div id="main">
	
	<%@ include file = "estructura/MenuAdmin.jsp" %>
		
	<div id="content">
	<h1>ABM MATERIAS</h1><br>
		<table>
			<tr>
			<th>Descripcion</th>
			<th>Hs Semanales</th>
			<th>Hs Totales</th>
			<th>Plan</th>
			<th>Especialidad</th>
			
			</tr>
			<tr>
			
		<%
			if(request.getAttribute("materias") != null){
				ArrayList<Materia> listaMaterias = new ArrayList<Materia>();
				listaMaterias = (ArrayList<Materia>)request.getAttribute("materias");
				for(Materia materia: listaMaterias){
					
			
		%>
		
			<td>
		<%	
				out.println(materia.getDescripcion() + "</td>");
		%>
			<td>
		<%	
				out.println(materia.getHsSemanales() + "</td>");
		%>
			<td>
		<%	
				out.println(materia.getHsTotales() + "</td>");
		%>
			<td>
		<%	
				out.println(materia.getNombrePlan() + "</td>");
		%>
			<td>
		<%	
				out.println(materia.getNombreEspecialidad() + "</td>");
		%>
				<td ><form  action="OpcionesAdmin" method="get" enctype="multipart/form-data" name="form"><input name="o" id="o" type="hidden"  value="22"><input name="idMateriaModificar"  type="hidden"  value="<%=materia.getId()%>"><input name="boton" id="boton" value="Modificar" type="submit"></form></td>
				<td ><form  action="OpcionesAdmin" method="get" enctype="multipart/form-data" name="form"><input name="o" id="o" type="hidden"  value="23"><input name="idMateriaEliminar"  type="hidden"  value="<%=materia.getId()%>"><input name="boton" id="boton" value="Eliminar" type="submit"></form></td>	</tr>
				
		
			<%
				}
				%>
				
				</table><br><br>
				
				<form  action="OpcionesAdmin" method="get" enctype="multipart/form-data" name="form"><input name="o" id="o" type="hidden"  value="24"><input name="boton" id="boton" value="Agregar" type="submit"></form>
				
				<%
			}
		%>	
			</div>
</div>
<%@ include file = "estructura/Footer.jsp" %>

<%}else{ //no logueado, se redirecciona a login%>



<meta http-equiv="refresh" content="0;URL=Login.jsp">

</html>
<%}%>
		
		